package com.api.mapper;

import com.api.pojo.Upkeep;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UpkeepMapper {

    @Insert("insert into upkeep(uid, content, img) value(#{uid}, #{content}, #{img})")
    void create(Upkeep upkeep);

    @Delete("delete from upkeep where id = #{id}")
    void remove(Integer id);

    @Update("update upkeep set content = #{content}, img = #{img}, state = #{state}, executor = #{executor}, et = #{et} where id = #{id}")
    void update(Upkeep upkeep);

    @Select("select * from upkeep limit #{pageNo}, #{pageSize}")
    List<Upkeep> get(Integer pageNo, Integer pageSize);

    @Select("select count(*) from upkeep")
    Integer count();

    @Select("select * from upkeep where uid = #{uid} limit #{pageNo}, #{pageSize}")
    List<Upkeep> getByUid(Integer pageNo, Integer pageSize, Integer uid);

    @Select("select count(*) from upkeep where uid = #{uid}")
    Integer countByUid(Integer uid);
}
